Source for file SC_SendMail.php
Documentation is available at SC_SendMail.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
$this->arrRecip = array();
$this->backend = MAIL_BACKEND;
mb_language( 'Japanese' );
//-- PEAR::Mailを使ってメール送信オブジェクト作成
$this->objMail = & Mail::factory($this->backend,
$this->arrRecip[$key] = $recipient;
function setTo($to, $to_name = "") {
function setFrom($from, $from_name = "") {
function setCc($cc, $cc_name = "") {
$this->reply_to = $reply_to;
$this->subject = mb_encode_mimeheader($subject, 'JIS', 'B', "\n");
$this->body = mb_convert_encoding($body, 'JIS', CHAR_CODE);
//-- PEAR::Mailを使ってメール送信オブジェクト作成
$this->objMail = & Mail::factory('smtp', $arrHost);
//-- PEAR::Mailを使ってメール送信オブジェクト作成
$this->objMail = & Mail::factory('smtp', $arrHost);
$_name = mb_encode_mimeheader($_name, 'JIS', 'B', "\n");
$name_address = "\"". $_name . "\"<" . $mail_address . ">";
$name_address = $mail_address;
function setItem($to, $subject, $body, $fromaddress, $from_name, $reply_to= "", $return_path= "", $errors_to= "", $bcc= "", $cc = "") {
$this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc);
function setItemHtml($to, $subject, $body, $fromaddress, $from_name, $reply_to= "", $return_path= "", $errors_to= "", $bcc= "", $cc = "") {
$this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc);
$fromaddress -> 送信元のメールアドレス
$from_name -> 送信元の名前(全角OK)
$return_path -> return-pathアドレス設定(エラーメール返送用)
function setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to= "", $return_path= "", $errors_to= "", $bcc= "", $cc = "") {
// 本文設定(iso-2022-jpだと特殊文字が?で送信されるのでJISを使用する)
$this->setFrom($fromaddress, $from_name);
// Errors-Toは、ほとんどのSMTPで無視され、Return-Pathが優先されるためReturn_Pathに設定する。
} else if($return_path != "") {
$arrHeader['MIME-Version'] = '1.0';
$arrHeader['To'] = $this->to;
$arrHeader['Subject'] = $this->subject;
$arrHeader['From'] = $this->from;
if($this->reply_to != "") {
$arrHeader['Reply-To'] = $this->reply_to;
$arrHeader['Cc'] = $this->cc;
$arrHeader['Bcc'] = $this->bcc;
$arrHeader['Date'] = date("D, j M Y H:i:s O");
$arrHeader['Content-Type'] = "text/plain; charset=\"ISO-2022-JP\"";
$arrHeader['Content-Transfer-Encoding'] = "7bit";
$arrHeader['Content-Type'] = "text/html; charset=\"ISO-2022-JP\"";
$arrHeader['Content-Transfer-Encoding'] = "ISO-2022-JP";
* @return array|stringメーラーバックエンドに応じた送信先
switch ($this->backend) {
// PEAR::Mail_mail#send は、(他のメーラーバックエンドと異なり) 第1引数を To: として扱う。Cc: や Bcc: は、ヘッダー情報から処理する。
* 設定された情報を利用して, メールを送信する.
$result = $this->objMail->send($recip, $header, $this->body);
if (PEAR::isError($result)) {
GC_Utils_Ex::gfPrintLog($result->getMessage());
GC_Utils_Ex::gfDebugLog($header);
* メーラーバックエンドに応じたパラメーターを返す.
* @param string $backend Pear::Mail のバックエンド
* @return array メーラーバックエンドに応じたパラメーターの配列
$arrParams = array('sendmail_path' => '/usr/bin/sendmail',
Documentation generated on Fri, 24 Feb 2012 14:02:56 +0900 by Seasoft
|